#define _CRT_SECURE_NO_WARNINGS 1
#include<vector>
using namespace std;
    int ret;
    int sum;
    int target;
    void dfs(vector<int>& nums, int index)
    {
        if (index == nums.size())
        {
            if (sum == target) ret++;
            return;
        }
        sum -= nums[index];
        dfs(nums, index + 1);
        sum += 2 * nums[index];
        dfs(nums, index + 1);
        sum -= nums[index];
    }
    int findTargetSumWays(vector<int>& nums, int _target) {
        target = _target;
        dfs(nums, 0);
        return ret;
    }
int main()
{
    vector<int> nums = { 1,2,3,4,5 };
    findTargetSumWays(nums, 5);
    return 0;
}